home *** CD-ROM | disk | FTP | other *** search
- #ifndef _CONTEXTUTILS_
- #define _CONTEXTUTILS_
-
- #include <A4Stuff.h>
- #include <ConditionalMacros.h>
- #include <MacTypes.h>
-
-
- #if GENERATING68K && !GENERATINGCFM
- #ifdef __cplusplus
- extern "C" {
- #endif
-
-
- #pragma parameter __D0 GetA4()
- unsigned long GetA4(void) ONEWORDINLINE(
- 0x200C); /* MOVE.L A4,D0 */
-
- #pragma parameter __D0 GetA5()
- unsigned long GetA5(void) ONEWORDINLINE(
- 0x200D); /* MOVE.L A5,D0 */
-
- #pragma parameter __D0 SwapA4(__D0)
- unsigned long SwapA4(unsigned long) ONEWORDINLINE(
- 0xC18C); /* EXG D0,A4 */
-
- #pragma parameter __D0 SwapA5(__D0)
- unsigned long SwapA5(unsigned long) ONEWORDINLINE(
- 0xC18D); /* EXG D0,A5 */
-
- #if __A5__
- #pragma parameter __D0 GetCurrentA5()
- extern UInt32 GetCurrentA5(void);
- #endif
-
-
- #ifdef __cplusplus
- }
- #endif
- #else
- #define GetA4() ((UInt32)0)
- #define GetA5() ((UInt32)0)
- #define SwapA4(x) ((UInt32)0)
- #define SwapA5(x) ((UInt32)0)
- #endif
-
-
- #if GENERATING68K && !GENERATINGCFM
- typedef class GlobalContext
- {
- public:
- #if __A5__
- UInt32 fOldA5;
-
- GlobalContext(void) { fOldA5 = SwapA5(GetCurrentA5()); }
- ~GlobalContext(void) { SwapA5(fOldA5); }
- #else
- UInt32 fOldA4;
-
- GlobalContext(void) { fOldA4 = SetCurrentA4(); }
- ~GlobalContext(void) { SetA4(fOldA4); }
- #endif
- } GlobalContext;
- #else
- typedef UInt32 GlobalContext;
- #endif
-
-
- typedef class THzContext
- {
- public:
- THz fOldZone;
-
- THzContext(THz zone) { fOldZone = GetZone(); SetZone(zone); }
- ~THzContext(void) { SetZone(fOldZone); }
- } THzContext;
-
-
- #endif /* _CONTEXTUTILS_ */
-